package com.sgl.myview.business.qqcehua;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;

import com.sgl.myview.R;
import com.sgl.myview.view.QQCeHuaLayout;
import com.sgl.myview.view.QQNewCeHuaLayout;

import butterknife.ButterKnife;
import butterknife.InjectView;

/**
 * Created by XH on 2016/12/14.
 */
public class QQCeHuaAdapter extends BaseAdapter {
    private Context mContext;

    public QQCeHuaAdapter(Context mContext) {
        this.mContext = mContext;
    }

    @Override
    public int getCount() {
        return 20;
    }

    @Override
    public Object getItem(int position) {
        return position;
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder viewHolder = null;
        if (convertView == null) {
            convertView = LayoutInflater.from(mContext).inflate(R.layout.adapter_qq_ce_hua, null);
            viewHolder = new ViewHolder(convertView);
            convertView.setTag(viewHolder);
        }else {
            viewHolder = (ViewHolder) convertView.getTag();
        }
        return convertView;
    }


    static class ViewHolder {
        @InjectView(R.id.cehua)
        QQNewCeHuaLayout cehua;

        ViewHolder(View view) {
            ButterKnife.inject(this, view);
        }
    }
}
